package com.dhemery.mack.adapters.tests;

import static org.junit.Assert.*;

import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.junit.Test;

import com.dhemery.mack.adapters.NodeAdapterFactory;

public class NodeAdapterFactoryAdapterListTests {

	@Test
	public void adaptsToIEditorInput() {
		IAdapterFactory factory = new NodeAdapterFactory(null);
		assertTrue(contains(IEditorInput.class, factory.getAdapterList()));
	}

	@Test
	public void adaptsToIWorkbenchAdapter() {
		IAdapterFactory factory = new NodeAdapterFactory(null);
		assertTrue(contains(IWorkbenchAdapter.class, factory.getAdapterList()));
	}

	private boolean contains(Object target, Object[] candidates) {
		for(Object candidate : candidates) {
			if(candidate.equals(target)) return true;
		}
		return false;
	}
}
